package typejump;

/**
 * This is a static class which acts as a global version of MessageList.
 * It's what's used for all the message passing in the application.
 * @author g
 *
 */
public class Messenger {

	private static MessageList list = new MessageList();
	
	private Messenger() {}
	
	public static String[] getMessages() {
		return list.getMessages();
	}
	
	/**
	 * Returns true if this list contains the specified message.
	 * @param message
	 * @return
	 */
	public static boolean hasMessage(String message) {
		return list.hasMessage(message);
	}
	
	/**
	 * Consumes this message, if it exists.
	 * @param message
	 * @return true if this message was in the list, false otherwise.
	 */
	public static boolean consumeMessage(String message) {
		return list.consumeMessage(message);
	}
	
	/**
	 * Adds this message to the list. Duplicates are allowed.
	 * @param message
	 */
	public static void addMessage(String message) {
		list.addMessage(message);
	}
	
	/**
	 * Adds this message to the list. It will be deleted after a full frame passes.
	 * @param message
	 */
	public static void addBriefMessage(String message) {
		list.addBriefMessage(message);
	}
	
	/**
	 * Returns the number of messages in this list.
	 * @return
	 */
	public static int messageCount() {
		return list.messageCount();
	}
	public static void tick() {
		list.tick();
	}
}
